package com.woniu.microworkorderserver.feign;

import com.woniu.microcommonsserver.param.ResponseMsg;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class MicroUserServerFallbackFactory implements FallbackFactory<UserServerFeign>{
    @Override
    public UserServerFeign create(Throwable throwable) {
        System.out.println("进入熔断");
        return new UserServerFeign() {
            @Override
            public ResponseMsg findFour() {

                return ResponseMsg.builder().code(200).msg("获取用户数据已达熔断").build();
            }

            @Override
            public ResponseMsg searchbyids(int[] ids) {
                return ResponseMsg.builder().code(200).msg("获取用户数据已达熔断").build();
            }

            @Override
            public ResponseMsg search(Map<String, Object> map) {
                return ResponseMsg.builder().code(200).msg("获取用户数据已达熔断").build();
            }

        };
    }
}
